<template>
  <div class="chat_page">
    <m-header modile-title="微信聊天" go-back="true"></m-header>
    <div class="main_inner clearfix">
      <div class="panel"></div>
      <div class="box chat">
        <div class="box_hd"></div>
        <!--聊天记录-->
        <div class="box_bd" id="messageList">
          <div class="message me">
            <img class="avatar" src="./image/imgMe.png"/>
            <div class="content">
              <div class="nickname"><span class="time">10:10:08</span></div>
              <div class="bubble bubble_primary right">
                <div class="bubble_cont">
                  <div class="plain">
                    <p>一顿大餐你欠我一顿大餐你欠我一顿大餐你欠我一顿大餐你欠我一顿大餐你欠我一顿大餐</p>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="message">
            <img class="avatar" src="./image/imgOther.png"/>
            <div class="content">
              <div class="nickname">友萍<span class="time">10:12:20</span></div>
              <div class="bubble bubble_default left">
                <div class="bubble_cont">
                  <div class="plain">
                    <p>(⊙o⊙)…好吧</p>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="message me">
            <img class="avatar" src="./image/imgMe.png"/>
            <div class="content">
              <div class="nickname"><span class="time">10:10:08</span></div>
              <div class="bubble bubble_primary right no_arrow">
                <div class="bubble_cont">
                  <div class="picture">
                    <img class="msg-img" src="./image/p1.png">
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="message">
            <img class="avatar" src="./image/imgOther.png"/>
            <div class="content">
              <div class="nickname">友萍<span class="time">10:12:20</span></div>
              <div class="bubble bubble_default left">
                <div class="bubble_cont">
                  <div class="plain">
                    <p>请你吃一个月大餐！</p>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <!--聊天记录end-->
        <div-input></div-input>
      </div>
    </div>
  </div>
</template>
<style lang="scss">
  .chat_page {
    width: 100%;
    padding-top: 40px;
    background: #fff;
    .main_inner {
      height: 100%;
      overflow: hidden;
      .panel {
        position: relative;
        width: 0px;
        height: 100%;
        float: left;
        background: #2e3238;
      }
      .box {
        position: relative;
        background-color: #eee;
        height: 100%;
        overflow: hidden;
        display: flex;
        flex-flow: column;
      }

      .box_hd {
        height: 0px;
      }

      .box_bd {
        padding: 10px 10px 0;
        overflow-y: auto;
        overflow-x: hidden;
        flex: 1;
        background: url(./image/bg.jpg) no-repeat;
        background-position: center;
        background-size: 100%;
      }

      .message {
        margin-bottom: 16px;
        float: left;
        width: 100%;
      }

      .message.me {
        float: right;
        text-align: right;
        clear: right;
      }

      .message .avatar {
        width: 40px;
        height: 40px;
        border-radius: 2px;
        -moz-border-radius: 2px;
        -webkit-border-radius: 2px;
        float: left;
        cursor: pointer;
      }

      .message.me .avatar {
        float: right;
      }

      .message .nickname {
        font-weight: 400;
        padding-left: 10px;
        font-size: 12px;
        height: 22px;
        line-height: 24px;
        color: #4f4f4f;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        word-wrap: normal;
      }

      .message .nickname .time {
        margin-left: 10px;
      }

      .message.me .nickname {
        padding-right: 10px;
      }

      .message.me .nickname .time {
        margin-right: 10px;
      }

      .message .content {
        overflow: hidden;
      }

      .bubble {
        max-width: 70%;
        min-height: 1em;
        display: inline-block;
        vertical-align: top;
        position: relative;
        text-align: left;
        font-size: 14px;
        border-radius: 3px;
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        margin: 0 10px;
      }

      .bubble.bubble_default {
        background-color: #fff;
      }

      .bubble:before,
      .bubble:after {
        position: absolute;
        top: 14px;
        border: 6px solid transparent;
        content: " ";
      }

      .bubble.left:before,
      .bubble.left:after {
        right: 100%;
      }

      .bubble.left:after {
        border-right-color: #FFF;
        border-right-width: 4px;
      }

      .bubble.right:before,
      .bubble.right:after {
        left: 100%;
      }

      .bubble.right:after {
        border-left-color: #FFF;
      }

      .bubble.bubble_primary {
        background-color: #b2e281;
      }

      .bubble.bubble_primary.left:after {
        border-right-color: #b2e281;
        border-right-width: 4px;
      }

      .bubble.bubble_primary.right:after {
        border-left-color: #b2e281;
        border-left-width: 4px;
      }

      .bubble.bubble_primary.right.arrow_primary:before {
        border-left-color: #b2e281;
        border-left-width: 4px;
      }

      .bubble.bubble_primary.right.arrow_primary:after {
        border-left-color: #fff;
        border-left-width: 4px;
        margin-left: -2px;
      }

      .bubble.no_arrow {
        background-color: transparent;
      }

      .bubble.no_arrow:before,
      .bubble.no_arrow:after {
        display: none;
      }

      .bubble_cont {
        word-wrap: break-word;
        word-break: break-all;
        min-height: 25px;
      }

      .bubble_cont img {
        vertical-align: middle;
      }

      .bubble_cont .plain {
        padding: 9px 13px;
      }

      .bubble_cont .picture {
        border-radius: 4px;
        -moz-border-radius: 4px;
        -webkit-border-radius: 4px;
        overflow: hidden;
        position: relative;
      }

      .bubble_cont .picture img {
        display: block;
        cursor: pointer;
        max-width: 100%;
      }



    }
    .clearfix:after {
      content: ' ';
      visibility: hidden;
      display: block;
      height: 0;
      clear: both;
    }
  }
</style>
<script>
  import mHeader from '../../../components/header'
  import {Toast} from 'mint-ui'
  import divInput from '../../../components/divInput'

  export default {
    data() {
      return {
        emojiShow: false, // 表情包显示隐藏
        wePicShow: true, // 文件夹图标显示隐藏
        weBtnShow: false, // 发送按钮显示隐藏
        emojiUrl: '', // 选中表情的储存
        innerText: ''
      }
    },
    methods: {
      // 文本框焦点事件
      // clickEdit() {
      //   setInterval(() => {
      //     var content = this.inputContent
      //     if (content.length > 0) {
      //       this.wePicShow = false;
      //       this.weBtnShow = true
      //     } else {
      //       this.wePicShow = true;
      //       this.weBtnShow = false
      //     }
      //   }, 200)
      // },

      // 选中表情
      emojiPic(e) {
        // console.log(e.target.className)
        // e.target.innerHTML
        // e.target.className
        var innerHtml = e.target.innerHTML
        console.log(innerHtml)
        var className = e.target.className
        this.emojiUrl = '<img :title=" + innerHtml + " :class=" + className + " :src="./image/spacer.png">'
        console.log(this.emojiUrl)
        this.inputContent = this.emojiUrl
        this.emojiShow = false
      }

    },
    components: {
      mHeader,
      divInput
    }
  }
</script>
